Embedded Linux Command Sheet

Table of Contents

Setting Date and Time1

Setting the date/time using "date"

date -s MMDDhhmm
date -s MMDDhhmmYY
date -s MMDDhhmmYY.ss

Setting your local timezone

# ls -l /etc/localtime
lrwxrwxrwx 1 root root 27 Jul 10 23:05 /etc/localtime -> /usr/share/zoneinfo/PST8PDT
# ln -s /usr/share/zoneinfo/CST6CDT /etc/localtime

You may want to try this if the above returns something like "file exists".
# ln -sf /usr/share/zoneinfo/CST6CDT /etc/localtime
# opkg install tzdata
# ln -sf /usr/share/zoneinfo/America/Los_Angeles /etc/localtime

Setting the date/time automatically with NTP

#+beignsrc sh opkg install ntpclient ntpclient -s -h pool.ntp.org ntpclient -s -h cn.pool.ntp.org ntpclient -s -h hk.pool.ntp.org #+endsrc

# opkg install ntpdate
# /usr/bin/ntpdate -b -s -u pool.ntp.org

Syncing the hardware clock

hwclock --systohc

Footnotes:

Author: Shi Shougang

Created: 2015-03-05 Thu 23:20

Emacs 24.3.1 (Org mode 8.2.10)

Validate